package cn.line5.seam.student;

import java.io.IOException;

import cn.line5.seam.annotations.AjaxRemote;
import cn.line5.seam.annotations.In;
import cn.line5.seam.annotations.Name;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

@Name("studentLoginRemote")
/**
 * <h1>LSEAM框架示例组件调用类</h1>
 * <br/>
 * 
 * @author Liu,yandong
 */
public class StudentLoginRemote {

	// request
	private HttpServletRequest request;
	
	@In("studentService")
	// 注入业务层接口
	private StudentService studentService;

	// 学生登录
	@AjaxRemote
	public Boolean login(StudentVo studentVo) throws ServletException, IOException {
		StudentVo vo = this.studentService.loginStudent(studentVo.getStudentLoginAccount(), "");
		if(vo != null && !vo.getStudentId().equals("")){
			vo = this.studentService.loginStudent(studentVo.getStudentLoginAccount(), studentVo.getStudentLoginPassword());
		}else{
			return false;
		}
		if(vo == null){
			return false;
		}else{
//			request.getSession().setAttribute("studentVo", vo);
			return true;
		}
	}
}
